import store from '../store'
export default {
	run(url) {
		uni.navigateTo({
			url: url,
			fail: (e) => {
				console.log(e)
			}
		});
	},
	getUserId(){
		return uni.getStorageSync('userInfo')._id||'';
	},
	getUserBackground(){
		/* vueX */
		// if(!store.getters.getBasicsUserBackground){
		// 	this.setUserBackground(uni.getStorageSync('userBackground')||'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-42f61864-8c3b-41c7-a6eb-875b941dfe63/d7037438-9ba1-441a-8bfe-387579903761.jpg')
		// }
		// return store.getters.getBasicsUserBackground;
		/* globalData */
		if(!getApp().globalData.basics.userBackground){
			this.setUserBackground(uni.getStorageSync('userBackground')||'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-42f61864-8c3b-41c7-a6eb-875b941dfe63/d7037438-9ba1-441a-8bfe-387579903761.jpg')
		}
		return getApp().globalData.basics.userBackground;
	},
	setUserBackground(url){
		uni.setStorageSync('userBackground',url)
		getApp().globalData.basics.userBackground=url;
		// store.commit('setBasicsUserBackground', url);
	}
}
